package database;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class ConnectionFactory {
	
	private static String DRIVE = "sun.jdbc.odbc.JdbcOdbcDriver";
	private static String PATH_BANCO = "Northwind/src/database/Northwind.mdb";
	private static String URL_ACCESS_1 ="jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=../";
	private static String URL_ACCESS_2 =";DriverID=22;READONLY=true}";
	private static String USER = "";
	private static String PASSWORD = "";

	public static Connection getConnection() throws SQLException {
		try {
			Class.forName(DRIVE);
			return DriverManager.getConnection(URL_ACCESS_1+PATH_BANCO+URL_ACCESS_2,USER, PASSWORD);
		} catch (ClassNotFoundException e) {
			throw new SQLException(e.getMessage());
		}
	}

}
